onclick Event |
This event is fired when a menu item is clicked.
Syntax
Inline HTML |
<div id=menuItemID onclick="handler()"...> ... </div> |
Event property |
menuItemID.onclick = handler |
Event Information
To invoke |
Right-click a shortcut menu and click a menu item under it. |
Default Action |
Initiates any action associated with this event. |
Event Object Properties
Although event handlers in the DHTML Object Model do not receive parameters directly, a handler can query an event object for data.
Property |
Description |
---|---|
activeElement |
Read-only. Object that denotes the HTML element to which the shortcut menu is attached. |
menuitem |
Read-only. Object that denotes the menu item that invoked theonclickevent. |
parentItem |
Read only. Object that denotes the parent item of a sub-menu item. |
Example
The following example shows how the event is used to display the clicked menu item.
<!-- Context menu definition inside the BODY tag --> <div cordysType = ="wcp.library.ui.ContextMenu " id="myContext"> <div onclick="alertMessage()">Say Hello</div> </div> //Alert the menu item function alertMessage() { application.notify("The element clicked is : " + event.menuitem.innerHTML); }